-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Font family preview in the font family picker #67118
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +4 B (0%) Total Size: 1.82 MB
ℹ️ View Unchanged
|
Flaky tests detected in d49960c. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11915286928
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delaying the review as feedback was provided in the related issue: #51151 (comment)
I updated the PR using the CustomSelectControl as suggested by @mirka in #51151 (comment). |
Thanks for moving this forward! I just tried to test this PR in WordPress playground and found that, while I could now see the Font Families, they didn't seem to properly update across the site, both when I made changes globally and to an individual block: Screen.Recording.2024-11-20.at.3.49.05.PM.movI'm not sure what's going on there. It might be Playground or something is off :) If it's playground, I'll report it to them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't tested, but I expect this will currently trigger a bunch of errors while rendering and while setting a new item. This is likely what @annezazu experienced.
Left a few suggestions that should resolve all issues.
I'd recommend keeping an eye on the console to ensure things work correctly and there are no errors.
@@ -51,14 +53,14 @@ export default function FontFamilyControl( { | |||
} | |||
|
|||
return ( | |||
<SelectControl | |||
<CustomSelectControl | |||
__next40pxDefaultSize={ __next40pxDefaultSize } | |||
__nextHasNoMarginBottom={ __nextHasNoMarginBottom } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to remove this prop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what prop are you pointing to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you mean __next40pxDefaultSize
, I see it used in other parts of the codebase where CustomSelectControl is rendered, too:
__next40pxDefaultSize={ __next40pxDefaultSize } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comment is referring to the __nextHasNoMarginBottom
prop, actually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, removed 1f94e6c
__next40pxDefaultSize={ __next40pxDefaultSize } | ||
__nextHasNoMarginBottom={ __nextHasNoMarginBottom } | ||
label={ __( 'Font' ) } | ||
options={ options } | ||
value={ value } | ||
onChange={ onChange } | ||
labelPosition="top" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this prop also should be removed. Aren't you getting some errors in the console when passing this prop? I think you should, since it will end up being wrongly passed down to the underlying DOM element.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like we are passing the options
as described in the component docs. See the options
description and data example in storybook: https://wordpress.github.io/gutenberg/?path=/docs/components-customselectcontrol--docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see console errors and it is used like that in other parts of the codebase. Example:
options={ selectOptions } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you are referring something that is valid for the CustomSelectControlV2
? I saw that control in the codebase, but it's not listed on storybook, and it doesn't seem to be in use in the Gutenberg codebase, so I'm not sure what it's their current state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comment is referring to the labelPosition
prop, not the options
prop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed here: 1f94e6c
Thanks for the reviews! With the latest change in Screencast.from.2024-11-21.08-41-31.mp4 |
@annezazu Thanks again for testing! I tried it in Playground, and it's working fine now: Screencast.from.2024-11-21.08-56-43.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost ready to go, we just need to remove the two props (see my answers to your questions in the preview review comments)
Thanks for the reviews. Those 2 props were removed in this commit: 1f94e6c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests well without console errors 👍 I think we're good to go once the tests pass.
@tyxla, your review is blocking the merge of this PR. Could you please take another look or lift the block? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @matiasbenedetto 🚀
What?
Style font family option in the font family picker.
Why?
To help users to select the desired font.
Fixes: #51151
How?
Using the CustomSelectControl component and setting the right style.
Testing Instructions
Open a font family picker and verify that each font family renders the family's name using the family's typography.
Screenshot